package com.acegear.horizon.domain.repository.jpa;

import com.acegear.horizon.domain.models.jpa.UserPost;

import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.PagingAndSortingRepository;

import java.util.List;
import java.util.Optional;

/**
 * Created by mercury on 2016/12/22.
 */
public interface UserPostRepository extends PagingAndSortingRepository<UserPost, Long> {
    List<UserPost> findByClubIdAndDeletedOrderByIdDesc(Long clubId, boolean deleted, Pageable pageable);

    List<UserPost> findByUserIdAndDeletedOrderByIdDesc(Long userId, boolean deleted, Pageable pageable);

    Optional<UserPost> findByPostId(Long postId);

    Optional<UserPost> findByPostIdAndDeleted(Long postId, boolean deleted);

    Integer countByUserIdAndDeleted(Long userId, boolean deleted);

    List<UserPost> findByPostIdGreaterThan(Long postId);

    List<UserPost> findAll();

    List<UserPost> findByDeletedAndPostIdIn(boolean deleted, List<Long> ids);
}
